package com.njy.cloudalibaba.provider.controller;


import cn.hutool.json.JSONUtil;
import com.njy.pojo.Dept;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class PaymentController {
    private final static Logger LOGGER = LoggerFactory.getLogger(PaymentController.class);

    @Value("${server.port}")
    private String serverPort;

    @GetMapping(value = "/payment/nacos/{id}")
    public String getPayment(@PathVariable("id") Integer id) {
        LOGGER.info("9002");
        return "nacos registry, serverPort: "+ serverPort+"\t id"+id;
    }
    @PostMapping(value = "/payment/nacos/{id}")
    public Map<String,String > getPayment(@PathVariable("id") Integer id, @RequestBody Dept dept) {
     /*   LOGGER.info("9001");
        LOGGER.info("dept "+dept.toString());*/
        Map<String,String > map = new HashMap<>();
        map.put("serverPort",serverPort);
        map.put("id",id+"");
        map.put("dept", dept.toString());
        return map;
    }


}
